<?
session_start();

$src = $_REQUEST["source"];
$oper = $_REQUEST["oper"];

if( !isset($src) || $src == '' || !isset($oper) || $oper == '' )
    die("Нарушение формата данных.");
 
if( !($conf = parse_ini_file('config.ini', TRUE)))
    die("Конфигурационный файл не найден");

$c_charset = isset($conf['DB']['charset']) ? $conf['DB']['charset'] : "utf8";
$dsn = "mysql:host=".$conf['DB']['dbserv'].";".
    "dbname=".$conf['DB']['dbname'].";".
    "charset=".$c_charset.";";

try {
    $db = new PDO( $dsn, $conf['DB']['dbuser'], $conf['DB']['dbpass'] );
	$db->exec('SET CHARACTER SET '.$c_charset);	
} 
catch (PDOException $e) {
    die();
}

switch ($src)
{
	case "CarImages":
        require_once( "classes/carImages.class.php" );
	    $ob = new CarImages($db);
		switch ($oper) {
			case "get":  $ob->GetImage();    break;
		}
        break;
        		
    default:
        die("Нарушение формата данных.");
}
?>
